perm filename CONCEP.DIF[CLS,LSP]2 blob sn#833460 filedate 1987-02-01 generic text, type C, neo UTF8
COMMENT āŠ—   VALID 00011 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00003 00002	  1) CONCEP.TEX[CLS,LSP] and 2) CONCEP.13[CLS,LSP]	2-01-87 10:57	pages 1,1
C00007 00003	  1) CONCEP.TEX[CLS,LSP] and 2) CONCEP.13[CLS,LSP]	2-01-87 10:57	pages 1,1
C00011 00004	  1) CONCEP.TEX[CLS,LSP] and 2) CONCEP.13[CLS,LSP]	2-01-87 10:57	pages 1,1
C00016 00005	  1) CONCEP.TEX[CLS,LSP] and 2) CONCEP.13[CLS,LSP]	2-01-87 10:57	pages 1,1
C00021 00006	  1) CONCEP.TEX[CLS,LSP] and 2) CONCEP.13[CLS,LSP]	2-01-87 10:57	pages 1,1
C00025 00007	  1) CONCEP.TEX[CLS,LSP] and 2) CONCEP.13[CLS,LSP]	2-01-87 10:57	pages 1,1
C00030 00008	  1) CONCEP.TEX[CLS,LSP] and 2) CONCEP.13[CLS,LSP]	2-01-87 10:57	pages 1,1
C00034 00009	  1) CONCEP.TEX[CLS,LSP] and 2) CONCEP.13[CLS,LSP]	2-01-87 10:57	pages 1,1
C00038 00010	  1) CONCEP.TEX[CLS,LSP] and 2) CONCEP.13[CLS,LSP]	2-01-87 10:57	pages 1,1
C00042 00011	  1) CONCEP.TEX[CLS,LSP] and 2) CONCEP.13[CLS,LSP]	2-01-87 10:57	pages 1,1
C00044 ENDMK
CāŠ—;
  1) CONCEP.TEX[CLS,LSP] and 2) CONCEP.13[CLS,LSP]	2-01-87 10:57	pages 1,1

**** File 1) CONCEP.TEX[CLS,LSP]/1P/118L
1)	In this case, we say that $C\sub{1}$ is a {\bit subclass\/} of
1)	$C\sub{n}$.  A class is considered neither a superclass nor a subclass of itself.  That 
1)	is, if $C\sub{1}$ is a superclass of $C\sub{2}$, then $C\sub{1} \neq
**** File 2) CONCEP.13[CLS,LSP]/1P/118L
2)	In this case, we say that $C\sub{n}$ is a {\bit subclass\/} of
2)	$C\sub{1}$.  A class is not considered a superclass of itself.  That
2)	is, if $C\sub{1}$ is a superclass of $C\sub{2}$, then $C\sub{1} \neq
***************


**** File 1) CONCEP.TEX[CLS,LSP]/1P/145L
1)	The class precedence list and its computation is discussed at
1)	length in the section ``Determining the Class Precedence List''.
1)	%When a class that includes a set of direct superclasses is defined,
**** File 2) CONCEP.13[CLS,LSP]/1P/145L
2)	The class precedence list and its computation will be discussed at
2)	length below.
2)	%When a class that includes a set of direct superclasses is defined,
***************


**** File 1) CONCEP.TEX[CLS,LSP]/1P/998L
1)	procedure a way to distinguish between methods.  A method that has one
1)	or more qualifiers is called a {\bit qualified\/} method.
1)	A method with no qualifiers is an {\bit unqualified method}. 
1)	A qualifier is any object other than a list; in other words, 
1)	any non-{\bf nil} atom.  By convention, qualifiers are usually keyword
**** File 2) CONCEP.13[CLS,LSP]/1P/998L
2)	procedure a way to distinguish between methods.  If a method has one
2)	or more qualifiers it is called a {\bit qualified\/} or {\bit
2)	auxiliary method}.  An unqualified method is called a {\bit primary
2)	method}.  A qualifier is any object other than a list; in other words,
2)	any non-{\bf nil} atom.  By convention, qualifiers are usually keyword
***************


**** File 1) CONCEP.TEX[CLS,LSP]/1P/1010L
1)	the ``shape'' of lambda lists for the methods of that 
1)	generic function.  All methods for the given generic function must be
**** File 2) CONCEP.13[CLS,LSP]/1P/1010L
2)	the ``shape'' of lambda lists for the methods of the corresonding 
2)	generic function.  All methods for the given generic function must be
***************


**** File 1) CONCEP.TEX[CLS,LSP]/1P/1074L
1)	\numitem{1.}{\it Select the set of applicable methods.\/}
  1) CONCEP.TEX[CLS,LSP] and 2) CONCEP.13[CLS,LSP]	2-01-87 10:57	pages 1,1

1)	Given a generic function and a set of arguments, the applicable methods are
**** File 2) CONCEP.13[CLS,LSP]/1P/1074L
2)	\numitem{1.}Select the set of applicable methods.
2)	Given a generic function and a set of arguments, the applicable methods are
***************


**** File 1) CONCEP.TEX[CLS,LSP]/1P/1096L
1)	\numitem{2.}{\it Sort the applicable methods by precedence order,
1)	putting the most specific method first.\/}
1)	To compare the precedence of two methods, examine their parameters in
**** File 2) CONCEP.13[CLS,LSP]/1P/1096L
2)	\numitem{2.}Sort the applicable methods by precedence order,
2)	putting the most specific method first.
2)	To compare the precedence of two methods, examine their parameters in
***************


**** File 1) CONCEP.TEX[CLS,LSP]/1P/1137L
1)	\numitem{3.}{\it Apply method combination to the sorted list of applicable methods,
1)	producing the effective method.\/}
1)	Considering the simplest case first, if standard method combination is used
**** File 2) CONCEP.13[CLS,LSP]/1P/1137L
2)	\numitem{3.}Apply method combination to the sorted list of applicable methods,
2)	producing the effective method.
2)	Considering the simplest case first, if standard method combination is used
***************


**** File 1) CONCEP.TEX[CLS,LSP]/1P/1185L
1)	\numitem{4.}{\it Apply the effective method to the generic function arguments.\/}
1)	The effective method is called with the same arguments that were passed
**** File 2) CONCEP.13[CLS,LSP]/1P/1185L
2)	\numitem{4.}Apply the effective method to the generic function arguments.
2)	The effective method is called with the same arguments that were passed
***************


**** File 1) CONCEP.TEX[CLS,LSP]/1P/1372L
1)	\beginsubSection{Long Form of Define-method-combination}
1)	\screen!
1)	[The following syntax expression needs to be converted to TEX:]
1)	(DEFINE-METHOD-COMBINATION name lambda-list                     [macro]
1)	      ( {(variable { {qualifier-pattern}+ | predicate}
1)	                   {keyword argument}*)}* )
1)	  {declaration | doc-string}*
1)	  {form}*)
1)	\endscreen!
  1) CONCEP.TEX[CLS,LSP] and 2) CONCEP.13[CLS,LSP]	2-01-87 10:57	pages 1,1

1)	{\it Name\/} is a symbol, usable as a
1)	name for this in the {\bf :method-combination} option to {\bf
**** File 2) CONCEP.13[CLS,LSP]/1P/1372L
2)	\beginsubSection{Short Form of Define-method-combination}
2)	% (DEFINE-METHOD-COMBINATION name operator {keyword argument}*)
2)	\Defmac {define-method-combination} {name operator \star{\curly{keyword argument}}}
2)	In both the short and long forms, {\it name\/} is a symbol, usable as a
2)	name for this in the {\bf :method-combination} option to {\bf
***************


**** File 1) CONCEP.TEX[CLS,LSP]/1P/1391L
1)	{\it lambda-list\/} is an ordinary lambda-list.  It receives any arguments provided
1)	after {\it name\/} in the {\bf :method-combination} option to 
1)	{\bf defgeneric-options} or {\bf defgeneric-options-setf}.
1)	A list of method-group specifiers follows.  Each specifier selects a subset
**** File 2) CONCEP.13[CLS,LSP]/1P/1383L
2)	The short form defines {\it name\/} as a type of method combination that
2)	produces a Lisp form {\bf ({\it operator method-call method-call...\/})}.
2)	{\it operator\/} is a symbol that can be the name of a function, macro,
2)	or special form.  By convention, {\it name\/} and {\it operator\/} are
2)	often the same symbol, but this is not required.
2)	Keyword options for the short form are: 
2)	\beginlist
2)	\item{\bull}
2)	{\bf :documentation} {\it string\/} documents the method-combination type.
2)	\item{\bull}
2)	{\bf :identity-with-one-argument} {\it boolean\/} enables an optimization
2)	when {\it boolean\/} is true (the default is false).
2)	If there is exactly one applicable method, and it is a primary method,
2)	that serves as the effective method and {\it operator\/} is not called.
2)	This optimization avoids the need to create a new effective method
2)	and avoids the overhead of a function call.
2)	Use this option with operators that are identity operators when 
2)	applied to one argument, such as {\bf progn}, {\bf and}, {\bf $+$}, 
2)	and {\bf max}.  
2)	\endlist
2)	None of the subforms is evaluated.
2)	A method combination procedure defined this way recognizes two roles for
2)	methods.  An unqualified method is a primary method.  A method with the
2)	keyword symbol with the same name as {\it name\/} as its one qualifier is
2)	also a primary method.  Attaching this qualifier to a primary method
2)	documents that this method is intended for use with an unusual form
2)	of method combination and can make programs easier to understand.
2)	A method with {\bf :around} as its one qualifier is an auxiliary method
2)	that behaves the same as a {\bf :around} method in standard method
2)	combination.
2)	{\bf call-next-method} can only be used in {\bf :around} methods, not in
  1) CONCEP.TEX[CLS,LSP] and 2) CONCEP.13[CLS,LSP]	2-01-87 10:57	pages 1,1

2)	primary methods.
2)	A method combination procedure defined this way accepts an optional 
2)	argument named order, defaulting to {\bf :most-specific-first}.  A value of
2)	{\bf :most-specific-last} reverses the order of the primary methods, without
2)	affecting the order of the auxiliary methods.  Use
2)	the {\bf (:method-combination {\it name\/} :most-specific-last)}
2)	option to {\bf defgeneric-options} or {\bf defgeneric-options-setf}
2)	to specify this.
2)	The short form syntax of {\bf define-method-combination} is 
2)	recognized when the second subform is a non-{\bf nil} 
2)	symbol.  A large fraction of the types of method combination needed by 
2)	most programmers can be implemented with this short form, which is 
2)	provided for convenience.   The short form automatically includes 
2)	error-checking and support for {\bf :around} methods, thus saving the
2)	programmer from writing that code, and avoids the need for the programmer to
2)	use the backquote and comma, and learn the more complex syntax of the long form.
2)	For example: 
2)	\screen!
2)	(define-method-combination and and :identity-with-one-argument t) 
2)	(defmethod func :and ((x class1) y) ...)
2)	\endscreen!
2)	\endsubSection%{Short Form of Define-method-combination}
2)	\beginsubSection{Long Form of Define-method-combination}
2)	%The following syntax expression needs to be converted to TEX
2)	(DEFINE-METHOD-COMBINATION name lambda-list                     [macro]
2)	      ( {(variable { {qualifier-pattern}+ | predicate}
2)	                   {keyword argument}*)}* )
2)	  {declaration | doc-string}*
2)	  {form}*)
2)	 
2)	The long form syntax of {\bf define-method-combination} is recognized 
2)	when the second subform is a list.  
2)	{\it lambda-list\/} is an ordinary lambda-list.  The first argument it 
2)	receives is the generic-function.  It also receives any arguments provided
2)	after {\it name\/} in the {\bf :method-combination} option to 
2)	{\bf defgeneric-options} or {\bf defgeneric-options-setf}.
2)	% The generic-function could instead be obtained from a method object, if
2)	% one has a method object in hand and if method objects contain references
2)	% to their generic function (currently under discussion).  Having a method
2)	% object in hand is iffy since a method-group might be empty.
2)	% Hence it seems better to pass the generic function explicitly. --Moon
2)	A list of method-group specifiers follows.  Each specifier selects a subset
***************


**** File 1) CONCEP.TEX[CLS,LSP]/1P/1445L
1)	Provides a description of the role of methods in this method-group.
1)	Programming environment tools use
  1) CONCEP.TEX[CLS,LSP] and 2) CONCEP.13[CLS,LSP]	2-01-87 10:57	pages 1,1

**** File 2) CONCEP.13[CLS,LSP]/1P/1530L
2)	Programming environment tools use
***************


**** File 1) CONCEP.TEX[CLS,LSP]/1P/1450L
1)	to print this description, which is expected to be concise, such 
1)	as one or two words.  
1)	This keyword option allows the description of a method qualifier to be
**** File 2) CONCEP.13[CLS,LSP]/1P/1534L
2)	to print a concise description of a method's role (one or two words).
2)	This keyword option allows the description of a method qualifier to be
***************


**** File 1) CONCEP.TEX[CLS,LSP]/1P/1463L
1)	Specifies the order of methods.
1)	The argument is a form evaluating to {\bf :most-specific-first} or
**** File 2) CONCEP.13[CLS,LSP]/1P/1546L
2)	The argument is a form evaluating to {\bf :most-specific-first} or
***************


**** File 1) CONCEP.TEX[CLS,LSP]/1P/1473L
1)	State whether at least one method in this method-group is required.  
1)	If {\it boolean\/} is true (not {\bf nil}), and the method-group is empty 
**** File 2) CONCEP.13[CLS,LSP]/1P/1555L
2)	If {\it boolean\/} is true (not {\bf nil}), and the method-group is empty 
***************


**** File 1) CONCEP.TEX[CLS,LSP]/1P/1518L
1)	Within the body {\it forms\/}, the lexical variable {\bf generic-function}
1)	is bound to the generic-function object, in case it is needed.
1)	If a doc-string is present, it documents the method-combination type.  
**** File 2) CONCEP.13[CLS,LSP]/1P/1599L
2)	If a doc-string is present, it documents the method-combination type.  
***************


**** File 1) CONCEP.TEX[CLS,LSP]/1P/1542L
1)	\beginsubSection{Short Form of Define-method-combination}
1)	% (DEFINE-METHOD-COMBINATION name operator {keyword argument}*)
1)	\Defmac {define-method-combination} {name \star{\curly{keyword argument}}}
1)	{\it Name\/} is a symbol, usable as a
1)	name for this in the {\bf :method-combination} option to {\bf
1)	defgeneric-options} or {\bf defgeneric-options-setf}.  By convention,
1)	non-keyword, non-{\bf nil} symbols are usually used.
  1) CONCEP.TEX[CLS,LSP] and 2) CONCEP.13[CLS,LSP]	2-01-87 10:57	pages 1,1

1)	The short form defines {\it name\/} as a type of method combination that
1)	produces a Lisp form {\bf ({\it operator method-call method-call...\/})}.
1)	{\it operator\/} is a symbol that can be the name of a function, macro,
1)	or special form.  By convention, {\it name\/} and {\it operator\/} are
1)	often the same symbol, but this is not required.  {\it operator\/}
1)	defaults to {\it name\/} unless specified by keyword option.
1)	The short form of {\bf define-method-combination} is 
1)	recognized when the second subform is a non-{\bf nil} 
1)	symbol or is not present.
1)	The long form of {\bf define-method-combination} is recognized 
1)	when the second subform is a list.  
1)	Keyword options for the short form are: 
1)	\beginlist
1)	\item{\bull}
1)	{\bf :documentation} {\it string\/} documents the method-combination type.
1)	\item{\bull}
1)	{\bf :identity-with-one-argument} {\it boolean\/} enables an optimization
1)	when {\it boolean\/} is true (the default is false).
1)	If there is exactly one applicable method, and it is a primary method,
1)	that serves as the effective method and {\it operator\/} is not called.
1)	This optimization avoids the need to create a new effective method
1)	and avoids the overhead of a function call.
1)	Use this option with operators that are identity operators when 
1)	applied to one argument, such as {\bf progn}, {\bf and}, {\bf $+$}, 
1)	and {\bf max}.  
1)	\item{\bull}
1)	{\bf :operator} {\it operator\/} specifies the name of the operator.
1)	If not specified, the name of the operator and the name of the method
1)	combination type are the same.
1)	\endlist
1)	None of the subforms is evaluated.
1)	A method combination procedure defined this way recognizes two roles for
1)	methods.  An unqualified method is a primary method.  A method with the
1)	keyword symbol with the same name as {\it name\/} as its one qualifier is
1)	also a primary method.  Attaching this qualifier to a primary method
1)	documents that this method is intended for use with an unusual form
1)	of method combination and can make programs easier to understand.
1)	A method with {\bf :around} as its one qualifier is an auxiliary method
1)	that behaves the same as a {\bf :around} method in standard method
1)	combination.
1)	{\bf call-next-method} can only be used in {\bf :around} methods, not in
1)	primary methods.
1)	A method combination procedure defined this way accepts an optional 
1)	argument named order, defaulting to {\bf :most-specific-first}.  A value of
1)	{\bf :most-specific-last} reverses the order of the primary methods, without
1)	affecting the order of the auxiliary methods.  Use
1)	the {\bf (:method-combination {\it name\/} :most-specific-last)}
1)	option to {\bf defgeneric-options} or {\bf defgeneric-options-setf}
  1) CONCEP.TEX[CLS,LSP] and 2) CONCEP.13[CLS,LSP]	2-01-87 10:57	pages 1,1

1)	to specify this.
1)	A large fraction of the types of method combination needed by 
1)	most programmers can be implemented with this short form, which is 
1)	provided for convenience.   The short form automatically includes 
1)	error-checking and support for {\bf :around} methods, thus saving the
1)	programmer from writing that code, and avoids the need for the programmer to
1)	use the backquote and comma, and learn the more complex syntax of the long form.
1)	For example: 
1)	\screen!
1)	(define-method-combination and :identity-with-one-argument t) 
1)	(defmethod func :and ((x class1) y) ...)
1)	\endscreen!
1)	The equivalent of this example in the long form is:
1)	\screen!
1)	(define-method-combination and 
1)	        (&optional (order ':most-specific-first))
1)	        ((around (:around))
1)	         (primary () (:and) :order order :required t))
1)	  (make-method-call `(,@around
**** File 2) CONCEP.13[CLS,LSP]/1P/1620L
2)	\beginsubSection{Examples of the Long Form of Define-method-combination}
2)	\screen!
2)	;The default method-combination technique
2)	(define-method-combination standard (generic-function)
2)	        ((around (:around))
2)	         (before (:before))
2)	         (primary () :required t)
2)	         (after (:after)))
2)	  (declare (ignore generic-function))
2)	  (make-method-call `(,@around
2)	                      (multiple-value-prog2
2)	                        ,(make-method-call before)
2)	                        ,(make-method-call primary :around t)
2)	                        ,(make-method-call (reverse after))))
2)	                    :around t))
2)	;A simple way to try several methods until one returns non-nil
2)	(define-method-combination and (generic-function)
2)	        ((methods () (:and)))
2)	  (declare (ignore generic-function))
2)	  (make-method-call methods :operator 'and))
2)	;A more complete version of the preceding
2)	(define-method-combination and 
2)	        (generic-function &optional (order ':most-specific-first))
2)	        ((around (:around))
2)	         (primary () (:and)))
2)	  (declare (ignore generic-function))
2)	  ;; Process the order argument
2)	  (case order
  1) CONCEP.TEX[CLS,LSP] and 2) CONCEP.13[CLS,LSP]	2-01-87 10:57	pages 1,1

2)	    (:most-specific-first)
2)	    (:most-specific-last (setq primary (reverse primary)))
2)	    (otherwise (method-combination-error "~S is an invalid order.~@
2)	    :most-specific-first and :most-specific-last are the possible values."
2)	                                         order)))
2)	  ;; Must have a primary method
2)	  (unless primary
2)	    (method-combination-error "A primary method is required."))
2)	  (make-method-call `(,@around
***************


**** File 1) CONCEP.TEX[CLS,LSP]/1P/1645L
1)	                    :operator :call-next-method))
1)	\endscreen!
1)	\endsubSection%{Short Form of Define-method-combination}
1)	\beginsubSection{Examples of the Long Form of Define-method-combination}
1)	\screen!
1)	;The default method-combination technique
1)	(define-method-combination standard ()
1)	        ((around (:around))
1)	         (before (:before))
1)	         (primary () :required t)
1)	         (after (:after)))
1)	  (make-method-call `(,@around
1)	                      (multiple-value-prog2
1)	                        ,(make-method-call before)
1)	                        ,(make-method-call primary
1)	                                           :operator :call-next-method)
1)	                        ,(make-method-call (reverse after))))
1)	                    :operator :call-next-method))
1)	;A simple way to try several methods until one returns non-nil
1)	(define-method-combination and ()
1)	        ((methods () (:and)))
1)	  (make-method-call methods :operator 'and))
1)	;A more complete version of the preceding
1)	(define-method-combination and 
1)	        (&optional (order ':most-specific-first))
1)	        ((around (:around))
1)	         (primary () (:and)))
1)	  ;; Process the order argument
1)	  (case order
1)	    (:most-specific-first)
1)	    (:most-specific-last (setq primary (reverse primary)))
1)	    (otherwise (method-combination-error "~S is an invalid order.~@
1)	    :most-specific-first and :most-specific-last are the possible values."
1)	                                         order)))
1)	  ;; Must have a primary method
  1) CONCEP.TEX[CLS,LSP] and 2) CONCEP.13[CLS,LSP]	2-01-87 10:57	pages 1,1

1)	  (unless primary
1)	    (method-combination-error "A primary method is required."))
1)	  (make-method-call `(,@around
**** File 2) CONCEP.13[CLS,LSP]/1P/1664L
2)	                    :around t))
2)	;The same thing, using the :order and :required keyword options
2)	(define-method-combination and 
2)	        (generic-function &optional (order ':most-specific-first))
2)	        ((around (:around))
2)	         (primary () (:and) :order order :required t))
2)	  (declare (ignore generic-function))
2)	  (make-method-call `(,@around
***************


**** File 1) CONCEP.TEX[CLS,LSP]/1P/1693L
1)	                    :operator :call-next-method))
1)	;The same thing, using the :order and :required keyword options
1)	(define-method-combination and 
1)	        (&optional (order ':most-specific-first))
1)	        ((around (:around))
1)	         (primary () (:and) :order order :required t))
1)	  (make-method-call `(,@around
1)	                      ,(make-method-call primary
1)	                                         :operator 'and
1)	                                         :identity-with-one-argument t))
1)	                    :operator :call-next-method))
1)	;This short-form call is behaviorally identical to the preceding
1)	(define-method-combination and :identity-with-one-argument t)
1)	 
**** File 2) CONCEP.13[CLS,LSP]/1P/1676L
2)	                    :around t))
2)	;This short-form call is behaviorally identical to the preceding
2)	(define-method-combination and and :identity-with-one-argument t)
2)	 
***************


**** File 1) CONCEP.TEX[CLS,LSP]/1P/1711L
1)	(define-method-combination example-method-combination ()
1)	        ((methods positive-integer-qualifier-p))
1)	  (make-method-call (stable-sort methods #'<
**** File 2) CONCEP.13[CLS,LSP]/1P/1683L
2)	(define-method-combination example-method-combination
2)	        (generic-function)
2)	        ((methods positive-integer-qualifier-p))
2)	  (declare (ignore generic-function))
2)	  (make-method-call (stable-sort methods #'<
  1) CONCEP.TEX[CLS,LSP] and 2) CONCEP.13[CLS,LSP]	2-01-87 10:57	pages 1,1

***************


**** File 1) CONCEP.TEX[CLS,LSP]/1P/1798L
1)	{\bf defgeneric-options}, or {\bf defgeneric-options-setf}.
1)	The \CLOS\ also provides the standard method combination type, which is 
1)	not implemented as a meta-object, but as a method. 
1)	%Includes objects for classes, objects for methods, objects for generic functions.
**** File 2) CONCEP.13[CLS,LSP]/1P/1772L
2)	{\bf defgeneric-options}, or {\bf defgeneric-options-setf},  
2)	The standard method combination type is also provided by the \CLOS\.  It is 
2)	not implemented as a meta-object, but as a method.  
2)	%Includes objects for classes, objects for methods, objects for generic functions.
***************